import formBuilder from "@/comps/form/formBuilder";
import api from "./api";
import apiGroup from "@/pages/v1/mes/PlanGroup/js/api";
import apiType from "@/pages/v1/mes/PlanType/js/api";
import apiStatus from "@/pages/v1/mes/PlanStatus/js/api";
import apiTask from "@/pages/v1/mes/Task/js/api";
import apiExecutor from "@/pages/v1/mes/Executor/js/api";

export default {
    main:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)
        fb.addText("sn","计划单号",4).setRules([fb.R.notNull()])
        fb.addSearch("taskId","产品",8).setApi(apiTask.urlChoice)
        fb.addText("name","计划名",4).setRules([fb.R.notNull()])
        fb.addCascade("statusId","状态",4).setApi(apiStatus.urlTree)
        fb.addCascade("executorId","实施单位",4).setApi(apiExecutor.urlTree)
        fb.addDateTime("startAt","开始时间",4).setShowTypeDate()
        fb.addDateTime("targetAt","计划完成时间",4).setShowTypeDate()
        fb.addDateTime("finishAt","实际完成时间",4).setShowTypeDate()
        fb.addText("numPlan","计划数量",3).setRules([fb.R.notNull()]).setTypeNumber()
        fb.addText("numDone","完成数量",3).setRules([fb.R.notNull()]).setTypeNumber()
        fb.addText("numNeed","需求数量",3).setRules([fb.R.notNull()]).setTypeNumber()
        fb.addText("numFeed","交付数量",3).setRules([fb.R.notNull()]).setTypeNumber()
        fb.addRadio("typeId","计划类型",6).setApi(apiType.urlChoice)
        fb.addRadio("groupId","计划分组",6).setApi(apiGroup.urlChoice)
        fb.addText("flag","计划标记",12)

        return fb
    },
    other:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        return fb
    }
}